//  路由表 
import { lazy,Suspense } from "react";
import { Navigate } from "react-router-dom";
import MyLoading from '../components/loading'
let Home = lazy(()=>import('../views/Home'));
let Info = lazy(()=>import('../views/Info'));
let Index = lazy(()=>import('../views/Index'));
let Cart = lazy(()=>import('../views/Cart'));
let Mine = lazy(()=>import('../views/Mine'));
let Login = lazy(()=>import('../views/Login'));
let ConfirmOrder = lazy(()=>import('../views/confirmOrder'))
let element = [
    {
        path:"/index",
        element:<Suspense fallback={<MyLoading/>}><Index/></Suspense>,
        author:false,
        children:[
            {
                path:"home",
                element:<Suspense fallback={<MyLoading/>}><Home/></Suspense>,
                author:false
            },{
                path:"cart",
                element:<Suspense fallback={<MyLoading/>}><Cart/></Suspense>,
                author:true
            },{
                path:"mine",
                element:<Suspense fallback={<MyLoading/>}><Mine/></Suspense>,
                author:true
            }
        ]
    },
    {
        path:"/info/:id",
        element:<Suspense fallback={<MyLoading/>}><Info/></Suspense>,
        author:false
    },{
        path:"/login",
        element:<Suspense fallback={<MyLoading/>}><Login/></Suspense>,
        author:false
    },{
        path:"/",
        element:<Navigate to="/index/home"></Navigate>
    },{
        path:"/conorder",
        element:<Suspense fallback={<MyLoading/>}><ConfirmOrder/></Suspense>,
        author:true
    }
]

export default element;